package com.mc.designpattern.factory.factory1;

public class ExportOperate {

    private ExportFileApi exportTxtFile;
    private ExportFileApi exportDB;

    public boolean export(int type, String data) {
        ExportFileApi api = null;
        if (type == 1) {
            api = exportTxtFile;
        } else if (type == 2) {
            api = exportDB;
        }
        return api.export(data);
    }

    public ExportOperate(ExportFileApi exportTxtFile, ExportFileApi exportDB) {
        this.exportTxtFile = exportTxtFile;
        this.exportDB = exportDB;
    }

    public ExportOperate() {
    }
}
